using namespace anima;
creatures::creatures(){//try{
int test_1=std::rand()%10000;
int test_2=std::rand()%10000;
int test_3=std::rand()%10000;
if (test_1==test_2==test_3) throw{creatures_errors::seed_for_random();}
//}catch (const creatures_errors& error){
//error.seed_for_random();
//}
}
virtual std::string creatures::representation(creatures& Creatures)const; // C++ String
virtual char* creatures::printf(creatures& Creatures); //C-Like string


inline int& creatures::get_x() const {return x;}
inline int& creatures::get_y() const {return y;}
inline void creatures::add_x()       {x++;}
inline void creatures::remove_x()    {x--;}
inline void creatures::set_x(int number_x) {x=number;}
inline void creatures::set_y(int number_y) {x=number;}
inline void creatures::add_y()             {y++;}
inline void creatures::remove_y()          {y--;}
inline int& creatures::get_hunger() const           {return hunger;}   
inline void creatures::set_hunger(int number_hunger){hunger=number_hunger;}
virtual void creatures::add_hunger()		    {hunger++;}
virtual void creatures::remove_hunger()		    {hunger--;}
inline int& creatures::get_vitality() const	         {return vitality;}
inline void creatures::set_vitality(int number_vitality) {vitality=number_vitality;}
virtual void creatures::add_vitality()		         {vitality++;}
virtual void creatures::remove_vitality()	         {vitality--;}
inline int& creatures::get_force() const	    {return force;}
inline void creatures::set_force(int number_force)  {force=number_force;}
virtual void creatures::add_force()                 {force++;}
virtual void creatures::remove_force()              {force--;}
inline int& creatures::get_instinct() const              {return instinct;}
inline void creatures::set_instinct(int number_instinct) {instinct=number_instinct;}
virtual void creatures::add_instinct()		         {instinct++;}
virtual void creatures::remove_instinct()		 {instinct--;}

virtual std::string creatures::used_skill() const;

creatures creatures::operator+(creatures male, creatures female){

creatures Creatures;
if(Creatures.female=static_cast<bool>(rand()%2) )Creatures.male=false;  else Creatures.male=true;
Creatures.x=female.x;
Creaures.y=female.y;
//Creatures.years=0;
//Creatures.months=0;
//Creatures.days=0;
//Creatures.hunger=0;
//Creatues.vitality=1;
//Creatures.force=1;
Creatures=set_unborn();
Creatures.instinct = std::rand() % 100;
int randomNumber3 = std::rand() % 3;   
int finalNumber3 = randomNumber3 - 1;
int randomNumber10 = std::rand() % 11;   
int finalNumber10 = randomNumber10 - 5;
int randomNumber20 = std::rand() % 21;   
int finalNumber20 = randomNumber20 - 10;
int randomNumber30 = std::rand() % 31; 
int finalNumber30 = randomNumber30 - 15;
int randomNumber2 = std::rand() % 2;   
int finalNumber2 = randomNumber2 + 1;
if (Creatures.male){
if(male.vitality_cap>=0&&male.vitality_cap<50) {Creatures.vitality_cap=male.vitality_cap+(finalNumber10); }
if(male.vitality_cap>=50&&male.vitality_cap<60) {Creatures.vitality=male.vitality_cap+(finalNumber20); }
if(male.vitality_cap>=60&&male.vitality_cap<70) {Creatures.vitality=male.vitality_cap+(finalNumber30); }
if(male.vitality_cap>=70&&male.vitality_cap<80) {Creatures.vitality=male.vitality_cap+(finalNumber20); }
if(male.vitality_cap>=80&&male.vitality_cap<90) {Creatures.vitality=male.vitality_cap+(finalNumber10); }
if(male.vitality_cap>=90&&male.vitality_cap<100) {Creatures.vitality=male.vitality_cap+(finalNumber3); }
if (Creatures.vitality_cap>CREATURES_CAP)Creatures.vitality_cap=CREATURES_CAP;
int diff_vitality=male.vitality-male.vitality_cap;
if (diff_vitality>0){
if (diff_vitality>15)Creatures.vitality_cap-=diff_vitality/randomNumber2;}else Creatures.vitality_cap-=diff_vitality;
if (Creatures.vitality_cap<female.vitality_cap){
int diff_vitality_cap_f=female.vitality_cap-Creatures.vitality_cap;
Creatures.vitality_cap+=diff_vitality_cap_f;}
}//male end
if (Creatures.female){
if(female.vitality_cap>=0&&female.vitality_cap<50) {Creatures.vitality_cap=female.vitality_cap+(finalNumber10); }
if(female.vitality_cap>=50&&female.vitality_cap<60) {Creatures.vitality=female.vitality_cap+(finalNumber20); }
if(female.vitality_cap>=60&&female.vitality_cap<70) {Creatures.vitality=female.vitality_cap+(finalNumber30); }
if(female.vitality_cap>=70&&female.vitality_cap<80) {Creatures.vitality=female.vitality_cap+(finalNumber20); }
if(female.vitality_cap>=80&&female.vitality_cap<90) {Creatures.vitality=female.vitality_cap+(finalNumber10); }
if(female.vitality_cap>=90&&female.vitality_cap<100) {Creatures.vitality=female.vitality_cap+(finalNumber3); }
if (Creatures.vitality_cap>CREATURES_CAP)Creatures.vitality_cap=CREATURES_CAP;
int diff_vitality=female.vitality-female.vitality_cap;
if (diff_vitality>0){
if (diff_vitality>15)Creatures.vitality_cap-=diff_vitality/randomNumber2;}else Creatures.vitality_cap-=diff_vitality;
//if (Creatures.vitality_cap<male.vitality_cap){
//int diff_vitality_cap_m=male.vitality_cap-Creatures.vitality_cap;
//Creatures.vitality_cap+=(diff_vitality_cap_m/2);}
//check dna active o passive heritage
Creatures.force_cap=Creatures.vitality_cap;
};//operator+ end


std::ostream& creatures::operator<<(ostream&, creatures Spectator);
std::istream& creatures::operator>>(istream&, creatures Actor);


